package com.woniuxy.oa.dao;

import com.woniuxy.oa.dao.provider.MessageProvider;
import com.woniuxy.oa.entity.Message;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Mr X
 */
public interface MessageDAO {
    /**
     * 增加消息
     *
     * @param message
     */
    @Insert("insert into oa_message values(#{id}, #{content},#{status},#{title},#{sendId},#{receiveId},#{messageTime})")
    public void add(Message message);

    /**
     * 通过ID修改状态
     *
     * @param id
     */
    @Update("update  oa_message set status=#{status} where id=#{id}")
    public void updateStatus(String status, String id);


    /**
     * 条件查询所有的消息
     *
     * @return
     */
    @SelectProvider(type = MessageProvider.class, method = "getSQL")
    public List<Message> getAll(Message message);

}
